home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 2000 #2 / Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO / products / bin / netscapefind.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2000-01-05  |  3KB  |  173 lines

  1. #!/bin/sh 
  2. PATH=/usr/ucb:/usr/bin:/usr/sbin:$PATH
  3. export PATH
  4.  
  5. ###############
  6. # sub routines#
  7. ###############
  8. enter_place() {
  9. echo -n "Location:";read WHERE
  10.  
  11. if [ "$WHERE" = "" ]; then
  12.  
  13.    return 
  14.  
  15. else
  16.  
  17.    WHERE=$WHERE"/netscape"
  18.    if [ -x $WHERE ];then
  19.         echo "  Checking $WHERE ..."
  20.         which_version
  21.    else
  22.    echo ""
  23.    echo "ERROR:  File does not exist or is not executable"
  24.    echo ""
  25.    echo "Please re-enter or press return."
  26.    enter_place
  27.    fi
  28.    echo ""
  29.    echo "ERROR:  File not Netscape Navigator version 2.0 or higher"
  30.    echo ""
  31.    echo "Please re-enter or press return."
  32.    enter_place
  33.  
  34. fi
  35. }
  36.  
  37. end_it() {
  38. echo ""
  39. echo "Hit return to end ..."
  40. read x
  41. exit 0
  42. }
  43.  
  44. run_it() { 
  45. echo ""
  46. echo "Netscape Navigator version $VERSION.0 or higher starting ..."
  47. echo ""
  48. echo "Running from $WHERE"
  49. $WHERE -geometry =665x770+0+0 file:///tmp/httpd/.products/CDware/index.netscape.html  
  50. end_it
  51.  
  52. which_version() {
  53. if [ ! -x $WHERE ]; then
  54.    echo ""
  55.    echo "ERROR:  File not present or executable." 
  56.    end_it
  57. else
  58.    VERSION=`$WHERE -version 2>&1 | sed 's/.[^0-9]*//' | sed 's/[^0-9].*//'` 
  59.    if [ "$VERSION" = "2" ]; then 
  60.       run_it
  61.    else
  62.       test="bad"
  63.       return 
  64.    fi
  65. fi
  66. }
  67.  
  68. ##########
  69. #end subs#
  70. ##########
  71. echo ""
  72. echo "PLEASE NOTE ....."
  73. echo "*****************"
  74. echo ""
  75. echo "This participant approval version of May Catalyst CDware does "
  76. echo "not contain the Netscape 2.0 or later browser we anticipate using"
  77. echo "as our front end.  THIS IS NOT THE WAY CDware WILL SHIP." 
  78. echo ""
  79. echo "Searching for Netscape Navigator 2.0 or later ..."
  80. echo ""
  81.  
  82. # CHECK: Netscape lies in path.
  83.  
  84. WHERE="`which netscape`"
  85.  
  86. NO=`echo $WHERE | sed 's/[^n].*//g'` 
  87.  
  88. if [ "$NO" = "n" ]; then
  89.          break    
  90. else
  91.      which_version 
  92. fi
  93. echo ""
  94. echo "  not in PATH ..."
  95. echo "" 
  96.  
  97. # CHECK:  Places Netscape could be.
  98.  
  99. places="$HOME/*etscape*/netscape /opt/*etscape*/netscape /export/*etscape*/netscape /extra/*etscape*/netscape "
  100.  
  101. for i in $places
  102. do 
  103.    if [ -x $i ];then
  104.     echo "  Checking $i ..."
  105.     WHERE=$i
  106.     which_version
  107.    fi 
  108. done
  109.  
  110. echo "  Checking /usr/* ..."
  111. for i in `find /usr/*/*etscape*/netscape -print`
  112. do
  113.    if [ -x $i ];then
  114.         echo "  Checking $i ..."
  115.         WHERE=$i
  116.         which_version
  117.    fi
  118. done
  119.  
  120. # CHECK:  Prompt user for location of Netscape.
  121.  
  122. echo ""
  123. echo "Unable to find Netscape2.0 or later Navigator in your path and in:"
  124. echo "" 
  125.  
  126. for i in $places 
  127. do
  128.    echo $i
  129. done
  130.  
  131. echo ""
  132. echo "Please specify which directory you have a Netscape2.0 or later Navigator."
  133. echo "If you not have a Netscape2.0 or later Navigator installed, please press return."
  134. echo ""
  135. enter_place
  136.  
  137. enter_place() {
  138. echo -n "Location:";read WHERE 
  139.  
  140. if [ "$WHERE" != ""; then
  141.  
  142.    continue
  143.  
  144. else
  145.  
  146.    WHERE=$WHERE"/netscape"
  147.    if [ -x $WHERE ];then
  148.         echo "  Checking $WHERE ..."
  149.         which_version
  150.    else 
  151.    echo ""
  152.    echo "ERROR:  File does not exist or is not executable"
  153.    echo ""
  154.    enter_place
  155.    fi
  156.    echo ""
  157.    echo "ERROR:  File not Netscape Navigator version 2.0 or higher"
  158.    echo ""
  159.    echo "Please re-enter or press return."
  160.    enter_place 
  161.    
  162. fi
  163. }
  164.  
  165. echo ""
  166. echo "You can download the latest version of Netscape Navigator at http://www.netscape.com"
  167. echo ""
  168. echo "Please install Netscape Navigator version 2.0 of later, then re-run this"
  169. echo "special participant"
  170.  
  171. end_it
  172.